﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace Chenxin.Lib.Cache
{
    public class CacheConn
    {
        public CacheConn() { }
        /// <summary>
        /// 定义连接串枚举类型
        /// </summary>
        public enum xCacheConn
        {
            /// <summary>
            /// 全局
            /// </summary>
            GLOBAL = 10,

            /// <summary>
            /// 人事
            /// </summary>
            HR = 20,

            /// <summary>
            /// 房源流通
            /// </summary>
            HOUSE = 30,

            /// <summary>
            /// 数据字典
            /// </summary>
            DICTDATA = 40,

            /// <summary>
            /// 交易合同
            /// </summary>
            TRADE=50,

            /// <summary>
            /// 贷款办证
            /// </summary>
            LOAN = 60,

            /// <summary>
            /// 财务
            /// </summary>
            FINANCE = 70,

            /// <summary>
            /// 统计数据
            /// </summary>
            REPORTS = 80,

            /// <summary>
            /// 接口
            /// </summary>
            API = 70,

            /// <summary>
            /// 门店
            /// </summary>
            DEPART = 90

        }

        /// <summary>
        /// 根据枚举值获取链接字符串
        /// </summary>
        /// <param name="cacheConn"></param>
        /// <returns></returns>
        public string GetCacheConn(xCacheConn cacheConn)
        {
            return this.GetType().GetField(cacheConn.ToString("G")).GetValue(this).ToString();
        }

        public static readonly string GLOBAL = ConfigurationManager.AppSettings["Cache.GLOBAL"];            //全局
        public static readonly string HR = ConfigurationManager.AppSettings["Cache.HR"];                    //人事
        public static readonly string HOUSE = ConfigurationManager.AppSettings["Cache.HOUSE"];              //房源
        public static readonly string DICTDATA = ConfigurationManager.AppSettings["Cache.DICTDATA"];        //数据字典
        public static readonly string API = ConfigurationManager.AppSettings["Cache.DATA"];                 //接口
        public static readonly string FINANCE = ConfigurationManager.AppSettings["Cache.FINANCE"];          //财务
        public static readonly string LOAN = ConfigurationManager.AppSettings["Cache.LOAN"];                //贷款办证
        public static readonly string REPORTS = ConfigurationManager.AppSettings["Cache.REPORTS"];          //统计数据
        public static readonly string DEPART = ConfigurationManager.AppSettings["Cache.DEPART"];            //门店
        
    }
}
